package org.leiyang.controller;

import org.leiyang.common.dtos.TestRequestVO;
import org.leiyang.service.combine.CombineService1;
import org.leiyang.service.feign.RemoteService;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@RestController
@RequestMapping("/b")
public class TestController {

    private final RemoteService remoteService;
    private final CombineService1 combineService1;

    public TestController(RemoteService remoteService, CombineService1 combineService1) {
        this.remoteService = remoteService;
        this.combineService1 = combineService1;
    }

    @GetMapping("/one/info")
    Mono<String> showOneInfo(String info){
        return remoteService.syncShowOneInfo(info);
    }

    @PostMapping("/names")
    Flux<String> listNames(@RequestBody TestRequestVO requestVO) {
        return remoteService.listNames(requestVO);
    }

    @PostMapping("/combine/a")
    Flux<String> combineA(@RequestBody TestRequestVO requestVO) {
        return combineService1.combineA(requestVO);
    }

    @PostMapping("/combine/b")
    Flux<String> combineB(@RequestBody TestRequestVO requestVO) {
        return combineService1.combineB(requestVO);
    }
}
